package com.asteros.crypto.utils.content.remote.client;

public class RemoteCMWebServiceProxy implements com.asteros.crypto.utils.content.remote.client.RemoteCMWebService {
  private String _endpoint = null;
  private com.asteros.crypto.utils.content.remote.client.RemoteCMWebService remoteCMWebService = null;
  
  public RemoteCMWebServiceProxy() {
    _initRemoteCMWebServiceProxy();
  }
  
  public RemoteCMWebServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initRemoteCMWebServiceProxy();
  }
  
  private void _initRemoteCMWebServiceProxy() {
    try {
      remoteCMWebService = (new com.asteros.crypto.utils.content.remote.client.RemoteCMWebServiceServiceLocator()).getRemoteCMWebService();
      if (remoteCMWebService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)remoteCMWebService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)remoteCMWebService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (remoteCMWebService != null)
      ((javax.xml.rpc.Stub)remoteCMWebService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.asteros.crypto.utils.content.remote.client.RemoteCMWebService getRemoteCMWebService() {
    if (remoteCMWebService == null)
      _initRemoteCMWebServiceProxy();
    return remoteCMWebService;
  }
  
  public byte[] getContent(java.lang.String userId, java.lang.String documentId) throws java.rmi.RemoteException{
    if (remoteCMWebService == null)
      _initRemoteCMWebServiceProxy();
    return remoteCMWebService.getContent(userId, documentId);
  }
  
  public boolean verifyDocumentSignature(java.lang.String userId, java.lang.String documentId) throws java.rmi.RemoteException{
    if (remoteCMWebService == null)
      _initRemoteCMWebServiceProxy();
    return remoteCMWebService.verifyDocumentSignature(userId, documentId);
  }
  
  public byte[] getSignedData(java.lang.String userId, java.lang.String documentId) throws java.rmi.RemoteException{
    if (remoteCMWebService == null)
      _initRemoteCMWebServiceProxy();
    return remoteCMWebService.getSignedData(userId, documentId);
  }
  
  public void saveSignedData(java.lang.String userId, java.lang.String documentId, byte[] buf) throws java.rmi.RemoteException{
    if (remoteCMWebService == null)
      _initRemoteCMWebServiceProxy();
    remoteCMWebService.saveSignedData(userId, documentId, buf);
  }
  
  
}